<form name="edit_profile_form" id="edit_profile_form" action="<?php echo BASE_PATH; ?>/users/edit/<?php echo $user["User"]["id"]; ?>" method="post" onsubmit="return validate_edit(this)" >
    <fieldset>
    <label for="name">Full Name:</label>
    <input type="text" name="name" value="<?php echo $user["User"]["name"]; ?>" id="name"/><br />

    <label for="password">Password:</label>
    <input type="password" name="password" value="<?php echo $user["User"]["password"]; ?>" id="password"/><br />

    <label for="confirm_password">Password (again):</label>
    <input type="password" name="confirm_password" value="<?php echo $user["User"]["password"]; ?>" id="confirm_password"/><br />

    <label for="dob">Date of Birth:</label>
    <input type="text" name="dob" value="<?php echo $user["User"]["dob"]; ?>" id="dob" onclick="displayDatePicker('dob');"/><br />

    <label for="email">Email:</label>
    <input type="text" name="email" value="<?php echo $user["User"]["email"]; ?>" id="email"/><br />

    <label for="gender">Gender:</label>
    <select name="gender" id="gender">
        <option value="Male" <?php if ($user["User"]["gender"] == "Male") echo "selected"; ?>>Male</option>
        <option value="Female" <?php if ($user["User"]["gender"] == "Female") echo "selected"; ?>>Female</option>
    </select><br />

    <label for="location">Location:</label>
    <input type="text" name="location" value="<?php echo $user["User"]["location"]; ?>" id="location"/><br />

    <label for="wall_rule">Wall Access:</label>
    <select name="wall_rule" id="wall_rule">
        <option value="0" <?php if ($user["User"]["wall_rule"] == "0") echo "selected"; ?>>Unrestricted</option>
        <option value="1" <?php if ($user["User"]["wall_rule"] == "1") echo "selected"; ?>>Only followers</option>
        <option value="2" <?php if ($user["User"]["wall_rule"] == "2") echo "selected"; ?>>Only me</option>
    </select><br />
    <?php if ($this->session->get("role_id") == 1): ?>
    <label for="blocked">Blocked:</label>
    <input type="checkbox" name="blocked" <?php if ($user["User"]["blocked"] == 1) echo "checked"; ?> id="blocked"/><br />
    <?php endif ?>

    <label for="twitter">Twitter oAuth:</label>
    <span id="twitter-buttton-link"<?php if ($user["User"]["twitter_username"] !== '') echo ' style="display: none;"'; ?>>
        <a href="#" class="twitter-button" onClick="window.open('<?php echo BASE_PATH; ?>/users/integrate', 'twitter_integrate', 'width=814,height=465')">Sign in with Twitter</a>
    </span>
    <span id="twitter-user"<?php if ($user["User"]["twitter_username"] === '') echo ' style="display: none;"'; ?>>
        <a target="_blank" id="twitter-user-link" href="http://twitter.com/<?php echo $user["User"]["twitter_username"]; ?>"><?php echo $user["User"]["twitter_username"]; ?></a>
        <a id="twitter-unlink" href="" onclick="return unlink();">(unlink)</a>
    </span>
    <input class="input-hidden" type="hidden" name="twitter_username" id="twitter_username" value="<?php echo $user["User"]["twitter_username"]; ?>" id="twitter_username"/>
    <input class="input-hidden" type="hidden" name="oauth_token" id="oauth_token" value=<?php echo $user["User"]["oauth_token"]; ?>"" id="oauth_token"/>
    <input class="input-hidden" type="hidden" name="oauth_token_secret" id="oauth_token_secret" value="<?php echo $user["User"]["oauth_token_secret"]; ?>" id="oauth_token_secret"/><br /><br />
    
    <input type="submit" name="submit" id="submit" value="Save" />
    </fieldset>
</form>
<script type="text/javascript">
    function unlink() {
        biji.select('#twitter-buttton-link').style.display = 'inline';
        biji.select('#twitter-user').style.display = 'none';
        biji.select('#twitter_username').value = '';
        biji.select('#oauth_token').value = '';
        biji.select('#oauth_token_secret').value = '';

        return false;
    }
</script>